This notebook explores the variance of traits across different levels of biological organization: within colonies, among colonies, among species, and among genera. There are many possibilities for analyses, so this will probably become a rather long notebook.
In this section, the distributions of traits are explored, without regard to environmental conditions. I compare the distribution of each trait within each species, including across all workers within each species and across colony means, across colony standard deviations, and across colony coefficients of variation. Lastly, I compare species-level CVs to colony-level CVs to begin to assess the proportion of variation within each species that is found within each colony.
The questions for this section are:
First, it’s worth just looking at the distribution of traits within each species. We can do this for each trait, ignoring which workers came from which colony, and just look at the distribution of the traits, \(y\).
Relative traits (top row) are remarkably uniform for the Myrmicine species. There are perhaps some slight differences among genera for relative interocular distance, leg length, and pronotal expansion, while Myrmica shows a bit more variation in scape proportion across species. Head shape is a bit more variable among Myrmicine genera, with Tetramorium showing higher values (wider heads). Lasius species are generally more variable, within and among species, though the distributions appear to overlap more for head shape and pronotal expansion, and L. fuliginosus stands out as different in terms of leg length and relative interocular distance.
For many traits, many species separate quite clearly. This is particularly true for the absolute traits (bottom row). For Myrmicine genera, there seems to be a strong effect of genus, while Lasius is rather variable. The distributions across species mostly are not obviously broader or narrower, with the exception of absolute traits in Manica, and again the Formicine genera. Tetramorium immigrans seems to separate from other Tetramorium species based on size, being slightly larger, and Tetramorium impurum separates by color, being slightly lighter. Particularly Myrmica species overlap almost entirely in the size-related traits (head width, head length, and Weber’s length). Lasius species are more distinct, especially L. fuliginosus, which stands out from the rest for essentially all traits including color.
Within genera, Myrmica species are most variable for scape proportion and head shape.
If we layer on the distribution of the colony means, \(\bar{y}_{js}\), we can see whether the workers are distributed much more broadly than the colony means, which would indicate that most of the variation occurs within colonies, or whether the distribution of colony means mirrors that of the workers, which would indicate that the variation among workers is structured among colonies. The distribution of \(y_{ijs}\) is partially transparent, and the distribution of \(\bar{y}_{js}\) is solid.
For the absolute traits (bottom row), we see that the distributions are almost entirely overlapping. Much of the variation in size and color occurs between colonies. There are many factors that could drive differences among colonies in these traits. For example, different temperatures could lead to faster or slower larval development, or indirectly through productivity and nutritional energy available to larvae. These traits could also vary through the season, with the sampling date interacting with the temperatures. Alternatively, the differences could be genetic, with selective pressure from the differing environments driving differences in mean worker body size, or simply random variation among colonies.
In contrast, most of the relative traits (top row) show markedly narrower distributions of colony means compared to worker traits. This indicates that for traits like pronotal expansion, each colony has workers that are quite variable. This seems to hold across species for these traits, rather than being clustered only within some species. Interocular distance and head shape seem to be somewhat intermediate, with some differences among colony means.
We can also look at the distribution of intra-colony standard deviations for each species and trait. I’m not sure this is very telling, aside from maybe the fact that the distributions are so similar across species for each trait.
Lastly, we can see the distribution of intra-colony CVs (\(\frac{d_{js}}{\bar{y}_{js}}\)).
We can see that generally the intra-colony CV is somewhere around 0-10%, which seems fairly low.
To revisit the questions for this section:
Here is variance partitioning with VCA::fitVCA() and confidence intervals calculated with VCA::VCAinference().
We can partition the variance for each species separately, comparing the contribution of colonies to intra-specific variance. For absolute traits, there is much more variation among colonies. In many species, the majority of the variance in each absolute trait can be explained by variation among colonies. In contrast, the relative traits tend to be less structured among colonies. That is, the distribution of basic ant shapes is relatively invariant among colonies, while traits like size or color tend to vary much more among colonies. Colonies within species may be larger or darker, but knowing the colony gives less information about the worker topology.
And we can assess this more rigorously with a GLMM, with logit-linked proportion of variance predicted by Relative and random effects for species. Maybe that’s the right way to do it…?
library(brms)
## Loading required package: Rcpp
## Loading 'brms' package (version 2.15.0). Useful instructions
## can be found by typing help('brms'). A more detailed introduction
## to the package is available through vignette('brms_overview').
##
## Attaching package: 'brms'
## The following object is masked from 'package:lme4':
##
## ngrps
## The following objects are masked from 'package:VCA':
##
## fixef, ranef
## The following object is masked from 'package:stats':
##
## ar
CV_trait.brms <- brm(CV ~ 0 + Trait * Effect + (1|SPECIESID),
data=filter(VC_traitInSpp, Effect != "Total") %>%
mutate(CV=`CV[%]`,
Trait=factor(Trait, levels=focus_traits,
labels=unique(paste0(str_sub(Relative, 1, 3),
": ", Trait)))))
## Compiling Stan program...
## Start sampling
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 1).
## Chain 1:
## Chain 1: Gradient evaluation took 8.3e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.83 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1:
## Chain 1:
## Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1:
## Chain 1: Elapsed Time: 0.697109 seconds (Warm-up)
## Chain 1: 0.533136 seconds (Sampling)
## Chain 1: 1.23025 seconds (Total)
## Chain 1:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 2).
## Chain 2:
## Chain 2: Gradient evaluation took 5.6e-05 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.56 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2:
## Chain 2:
## Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2:
## Chain 2: Elapsed Time: 0.784237 seconds (Warm-up)
## Chain 2: 0.438717 seconds (Sampling)
## Chain 2: 1.22295 seconds (Total)
## Chain 2:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 3).
## Chain 3:
## Chain 3: Gradient evaluation took 4.1e-05 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.41 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3:
## Chain 3:
## Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3:
## Chain 3: Elapsed Time: 0.710286 seconds (Warm-up)
## Chain 3: 0.461147 seconds (Sampling)
## Chain 3: 1.17143 seconds (Total)
## Chain 3:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 4).
## Chain 4:
## Chain 4: Gradient evaluation took 2.9e-05 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.29 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4:
## Chain 4:
## Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4:
## Chain 4: Elapsed Time: 0.797967 seconds (Warm-up)
## Chain 4: 0.46693 seconds (Sampling)
## Chain 4: 1.2649 seconds (Total)
## Chain 4:
conditional_effects(CV_trait.brms)
CV_trait.lm <- lmer(
`CV[%]` ~ 0 + Trait * Effect + (1|SPECIESID),
data=filter(VC_traitInSpp, Effect != "Total") %>%
mutate(Trait=factor(Trait, levels=focus_traits,
labels=unique(paste0(str_sub(Relative, 1, 3),
": ", Trait)))))
car::Anova(CV_trait.lm, type="III")
## Registered S3 methods overwritten by 'car':
## method from
## influence.merMod lme4
## cooks.distance.influence.merMod lme4
## dfbeta.influence.merMod lme4
## dfbetas.influence.merMod lme4
sjPlot::plot_model(CV_trait.lm, type="int", colors=varPart_cols) + coord_flip()
summary(pairs(emmeans::lsmeans(CV_trait.lm, ~Trait * Effect)), type="response")
CV_Rel.brms <- brm(CV ~ 0 + Effect * Relative + (1|SPECIESID),
data=filter(VC_traitInSpp, Effect != "Total") %>%
mutate(CV=`CV[%]`))
## Compiling Stan program...
## recompiling to avoid crashing R session
## Start sampling
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 1).
## Chain 1:
## Chain 1: Gradient evaluation took 6e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.6 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1:
## Chain 1:
## Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1:
## Chain 1: Elapsed Time: 0.536214 seconds (Warm-up)
## Chain 1: 0.408576 seconds (Sampling)
## Chain 1: 0.94479 seconds (Total)
## Chain 1:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 2).
## Chain 2:
## Chain 2: Gradient evaluation took 2.6e-05 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.26 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2:
## Chain 2:
## Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2:
## Chain 2: Elapsed Time: 0.507418 seconds (Warm-up)
## Chain 2: 0.336479 seconds (Sampling)
## Chain 2: 0.843897 seconds (Total)
## Chain 2:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 3).
## Chain 3:
## Chain 3: Gradient evaluation took 2.5e-05 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.25 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3:
## Chain 3:
## Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3:
## Chain 3: Elapsed Time: 0.552982 seconds (Warm-up)
## Chain 3: 0.37226 seconds (Sampling)
## Chain 3: 0.925242 seconds (Total)
## Chain 3:
##
## SAMPLING FOR MODEL '935363b0a2bc13fd17281a70697880de' NOW (CHAIN 4).
## Chain 4:
## Chain 4: Gradient evaluation took 4.6e-05 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.46 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4:
## Chain 4:
## Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4:
## Chain 4: Elapsed Time: 0.593937 seconds (Warm-up)
## Chain 4: 0.349309 seconds (Sampling)
## Chain 4: 0.943246 seconds (Total)
## Chain 4:
conditional_effects(CV_Rel.brms)
CV_Rel.lm <- lmer(
`CV[%]` ~ 0 + Relative * Effect + (1|SPECIESID),
data=filter(VC_traitInSpp, Effect != "Total"))
car::Anova(CV_Rel.lm, type="III")
sjPlot::plot_model(CV_Rel.lm, type="int", colors=varPart_cols) + coord_flip()
summary(pairs(emmeans::lsmeans(CV_Rel.lm, ~Relative * Effect)), type="response")
Here is some PCA.
What traits drive differences among workers? Do they separate into clusters based on taxonomy? Relative traits are shown in red, with absolute traits in blue.
Do colony means show a similar pattern as individual workers?
Are colonies of different species more or less variable for particular traits? Or are some species or genera more or less variable overall?
## $`1`
##
## $`2`
##
## attr(,"class")
## [1] "list" "ggarrange"
## $`1`
##
## $`2`
##
## $`3`
##
## $`4`
##
## $`5`
##
## $`6`
##
## $`7`
##
## $`8`
##
## $`9`
##
## attr(,"class")
## [1] "list" "ggarrange"